package com.baosight.sczx.zm.cs.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.threadlocal.UserSession;
import com.baosight.iplat4j.ef.ui.tree.TreeConstants;
import com.baosight.iplat4j.ef.ui.tree.TreeService;
import com.baosight.iplat4j.ep.QueryMap;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.basetools.TablePk;
import com.baosight.sczx.common.zm.cInterface.cs.Coalseam;
import com.baosight.sczx.common.zm.cInterface.cs.Level;
import com.baosight.sczx.common.zm.cInterface.cs.Miningarea;
import com.baosight.sczx.common.zm.cInterface.cs.RoadWay;
import com.baosight.sczx.common.zm.cInterface.cs.WorkingFace;
import com.baosight.sczx.common.zm.cInterface.cs.InitialData;
import com.baosight.sczx.zm.cs.domain.ZMCSCoalseam;
import com.baosight.sczx.zm.cs.domain.ZMCSLevel;
import com.baosight.sczx.zm.cs.domain.ZMCSMine;
import com.baosight.sczx.zm.cs.domain.ZMCSMiningarea;
import com.baosight.sczx.zm.cs.domain.ZMCSWorkingFace;

/**
 * <p>Title: ServiceZMCS01.java</p>
 * <p>Description: 矿井模型信息,构造树</p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张坤
 * @version 1.0
 * <pre>Histroy:
 *          2016-06-21下午15:31:29  张坤  Create
 *</pre>
 */

public class ServiceZMCS01 extends TreeService  {

	private String mineKeyId;
	/**
	 * <p>Function: initLoad</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	@Override
	public EiInfo initLoad(EiInfo inInfo) {

		EiInfo outInfo = new EiInfo();
		//判断当前登录人员所在矿区是否有根节点，如果没有，进行新增
		List<ZMCSMine>  _list = new ArrayList();
		Map para = new HashMap();
		para.put("fdMiningId", UserSession.getInSessionProperty("miningCode"));
		_list = dao.query("ZMCSMine.query", para);
		if(_list.size()<=0)
		{
			ZMCSMine _dom = new ZMCSMine();
			String KeyId=TablePk.getInstance().getNextValue("T_CI_MINE");
			String fdNo=StaticTools.getDocId();
			fdNo=fdNo.substring(fdNo.length()-10);
			_dom.setFdNo(fdNo);
			_dom.setFdKeyId(KeyId);
			_dom.setFdMiningId(UserSession.getInSessionProperty("miningCode").toString());
			_dom.setFdName(UserSession.getInSessionProperty("miningName").toString());
			_dom.setFdStatus("生产");
			this.dao.insert("ZMCSMine.insert",_dom);
			outInfo.set("fdKeyId", KeyId);
		} else
		{
			outInfo.set("fdKeyId", _list.get(0).getFdKeyId());
		}	
		
		
		outInfo.set("value", "0");
		outInfo.set("fdCreatorId", UserSession.getUserId());//登录人的默认值
		outInfo.set("fdCreator", UserSession.getInSessionProperty("UserCname"));
		outInfo.set("fdCreateDepartmentId", UserSession.getInSessionProperty("orgCode"));//单位的默认值		
		outInfo.set("fdCreateDepartment", UserSession.getInSessionProperty("orgName"));//单位的默认值
		outInfo.set("fdMiningId", UserSession.getInSessionProperty("miningCode"));//矿ID的默认值
		outInfo.set("fdMiningName", UserSession.getInSessionProperty("miningName"));//矿名称的默认值
	 
		
		return outInfo;
	}
	
	/**首次进入系统新增矿井信息
	 * <p>Function: insertMine</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public EiInfo insertMine(EiInfo inInfo) {
		List<Map>  _list = new ArrayList();
		Map para = new HashMap();
		_list = dao.query("ZMCSMine.query", para);
		if(_list.size() ==0)//首次新增
		{
			mineKeyId = TablePk.getInstance().getNextValue("T_CI_MINE");
			inInfo.getBlock("mineBlock").setCell(0, "fdKeyId", mineKeyId);//主键
			inInfo.getBlock("mineBlock").setCell(0, "fdStatus", "生产");//状态
			inInfo.getBlock("mineBlock").setCell(0, "fdDepartmentId", UserSession.getInSessionProperty("orgCode"));//部门id
			super.insert(inInfo, "ZMCSMine.insert", "mineBlock");
		}else//更新
		{
			super.update(inInfo, "ZMCSMine.update","mineBlock");
		}
		String MingModel="0";
		inInfo.set("value", MingModel);
		if(MingModel.equals("1"))//采区
		{
			inInfo.addBlock(Level.getParnetInforMABlock());//采区所属下拉框
			inInfo.addBlock(RoadWay.getYesORNoBlock("cmes.cb.IsStratified"));//是否分层下拉框
			inInfo.addBlock(Miningarea.getIsWings("cmes.cb.IsWings"));//是否两翼开采下拉框
			inInfo.addBlock(RoadWay.getYesORNoBlock("cmes.cb.IsFirstMA"));//是否首采区
		}else if(MingModel.equals("2"))//煤层
		{
			inInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.mineStabilty",false));//稳定性
			inInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.mineType",true));//煤种
			inInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.dipType",true));//倾斜类型
		}else
		{
			inInfo.addBlock(RoadWay.getYesORNoBlock("cmes.cb.IsFirstH"));//是否为第一水平
		}
		
		return inInfo;
	}
	
	/**首次进入系统新增水平信息
	 * <p>Function: insertH</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public EiInfo insertH(EiInfo inInfo) {
		List<Map>  _list = new ArrayList();
		Map para = new HashMap();
		_list = dao.query("ZMCSLevel.query", para);
		if(_list.size() ==0)//首次新增
		{
			for(int i=0;i<inInfo.getBlock("HBlock").getRowCount();i++)
			{
				inInfo.getBlock("HBlock").setCell(i, "fdKeyId", TablePk.getInstance().getNextValue("T_CI_LEVEL"));//主键
				inInfo.getBlock("HBlock").setCell(i, "fdMineId", mineKeyId);//部门id
			}
			super.insert(inInfo, "ZMCSLevel.insert", "HBlock");
		}else//上一步更新
		{
			for(int i=0;i<inInfo.getBlock("HBlock").getRowCount();i++)
			{
				String fdKeyId = inInfo.getBlock("HBlock").getCell(i, "fdKeyId").toString();
				if(fdKeyId.equals(""))
				{
					Map map = new HashMap();
					map.put("fdKeyId", TablePk.getInstance().getNextValue("T_CI_LEVEL"));//主键
					map.put("fdMineId", mineKeyId);//所属主键
					map.put("fdNo", inInfo.getBlock("HBlock").getCell(i, "fdNo"));//编号
					map.put("fdName", inInfo.getBlock("HBlock").getCell(i, "fdName"));//名称
					map.put("fdElevation", inInfo.getBlock("HBlock").getCell(i, "fdElevation"));//标高
					dao.insert("ZMCSLevel.insert", map);//新增
				}else
				{
					for(int j=0; j<_list.size();j++){
						ZMCSLevel _temp = (ZMCSLevel)_list.get(j);
						if (_temp.getFdKeyId().equals(fdKeyId)) {
							Map _argMap = new HashMap();
							_argMap.put("fdKeyId", fdKeyId);
							_argMap.put("fdMineId", mineKeyId);//所属主键
							_argMap.put("fdNo", inInfo.getBlock("HBlock").getCell(i, "fdNo"));//编号
							_argMap.put("fdName", inInfo.getBlock("HBlock").getCell(i, "fdName"));//名称
							_argMap.put("fdElevation", inInfo.getBlock("HBlock").getCell(i, "fdElevation"));//标高
							dao.update("ZMCSLevel.update", _argMap);//更新
						}
					}
				}
			}
			//删除
			for(int j=0; j<_list.size();j++)
			{
				ZMCSLevel _temp = (ZMCSLevel)_list.get(j);
				int count =0;
				for (int i=0;i<inInfo.getBlock("HBlock").getRowCount();i++) {
					String fdKeyId = inInfo.getBlock("HBlock").getCell(i, "fdKeyId").toString();
					if (!_temp.getFdKeyId().equals(fdKeyId)) {
						count++;						
					}
				}
				if(count == inInfo.getBlock("HBlock").getRowCount())
				{
					Map<String, String> _argMap = new HashMap<String, String>();
					_argMap.put("fdKeyId", _temp.getFdKeyId().toString());
					dao.delete("ZMCSLevel.delete", _argMap);//更新
				}
			}
		}
		//采区
		EiInfo outInfo = new EiInfo();
		outInfo.addBlock(Level.getParnetInforMABlock());//采区所属下拉框
		outInfo.addBlock(RoadWay.getYesORNoBlock("cmes.cb.IsStratified"));//是否分层下拉框
		outInfo.addBlock(RoadWay.getYesORNoBlock("cmes.cb.IsFirstMA"));//是否首采区
		outInfo.addBlock(Miningarea.getIsWings("cmes.cb.IsWings"));//是否两翼开采下拉框
		outInfo.setStatus(1);
		return outInfo;
	}
	
	/**首次进入系统新增采区信息
	 * <p>Function: insertMA</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	public EiInfo insertMA(EiInfo inInfo) {
		List<Map>  _list = new ArrayList();
		Map para = new HashMap();
		_list = dao.query("ZMCSMiningarea.query", para);
		if(_list.size() ==0)//首次新增
		{
			for(int i=0;i<inInfo.getBlock("MABlock").getRowCount();i++)
			{
				inInfo.getBlock("MABlock").setCell(i, "fdKeyId", TablePk.getInstance().getNextValue("T_CI_MININGAREA"));//主键
			}
			super.insert(inInfo, "ZMCSMiningarea.insert", "MABlock");
		}else
		{
			for(int i=0;i<inInfo.getBlock("MABlock").getRowCount();i++)
			{
				String fdKeyId = inInfo.getBlock("MABlock").getCell(i, "fdKeyId").toString();
				if(fdKeyId.equals(""))
				{
					Map map = new HashMap();
					map.put("fdKeyId", TablePk.getInstance().getNextValue("T_CI_MININGAREA"));//主键
					map.put("fdParentId", inInfo.getBlock("MABlock").getCell(i, "fdParentId"));//区域主键
					map.put("fdName", inInfo.getBlock("MABlock").getCell(i, "fdName"));//姓名
					map.put("fdNo", inInfo.getBlock("MABlock").getCell(i, "fdNo"));//编号
					map.put("fdTrendLength", inInfo.getBlock("MABlock").getCell(i, "fdTrendLength"));//走向长度
					map.put("fdTendencyLength", inInfo.getBlock("MABlock").getCell(i, "fdTendencyLength"));//倾向长度
					map.put("fdRecoverableReserves", inInfo.getBlock("MABlock").getCell(i, "fdRecoverableReserves"));//可采储量
					map.put("fdManufacturability", inInfo.getBlock("MABlock").getCell(i, "fdManufacturability"));//生产能力
					map.put("fdDesignReserves", inInfo.getBlock("MABlock").getCell(i, "fdDesignReserves"));//设计储量
					map.put("fdServiceYear", inInfo.getBlock("MABlock").getCell(i, "fdServiceYear"));//服务年限
					map.put("fdUpperElevation", inInfo.getBlock("MABlock").getCell(i, "fdUpperElevation"));//上限标高
					map.put("fdLowerElevation", inInfo.getBlock("MABlock").getCell(i, "fdLowerElevation"));//下限标高
					map.put("fdIsStratified", inInfo.getBlock("MABlock").getCell(i, "fdIsStratified"));//是否分层
					map.put("fdIsWings", inInfo.getBlock("MABlock").getCell(i, "fdIsWings"));//是否两翼开采
					dao.insert("ZMCSMiningarea.insert", map);//新增
				}else
				{
					for(int j=0; j<_list.size();j++){
						ZMCSMiningarea _temp = (ZMCSMiningarea)_list.get(j);
						if (_temp.getFdKeyId().equals(fdKeyId)) {
							Map _argMap = new HashMap();
							_argMap.put("fdKeyId", fdKeyId);
							_argMap.put("fdParentId", inInfo.getBlock("MABlock").getCell(i, "fdParentId"));//区域主键
							_argMap.put("fdName", inInfo.getBlock("MABlock").getCell(i, "fdName"));//姓名
							_argMap.put("fdNo", inInfo.getBlock("MABlock").getCell(i, "fdNo"));//编号
							_argMap.put("fdTrendLength", inInfo.getBlock("MABlock").getCell(i, "fdTrendLength"));//走向长度
							_argMap.put("fdTendencyLength", inInfo.getBlock("MABlock").getCell(i, "fdTendencyLength"));//倾向长度
							_argMap.put("fdRecoverableReserves", inInfo.getBlock("MABlock").getCell(i, "fdRecoverableReserves"));//可采储量
							_argMap.put("fdManufacturability", inInfo.getBlock("MABlock").getCell(i, "fdManufacturability"));//生产能力
							_argMap.put("fdDesignReserves", inInfo.getBlock("MABlock").getCell(i, "fdDesignReserves"));//设计储量
							_argMap.put("fdServiceYear", inInfo.getBlock("MABlock").getCell(i, "fdServiceYear"));//服务年限
							_argMap.put("fdUpperElevation", inInfo.getBlock("MABlock").getCell(i, "fdUpperElevation"));//上限标高
							_argMap.put("fdLowerElevation", inInfo.getBlock("MABlock").getCell(i, "fdLowerElevation"));//下限标高
							_argMap.put("fdIsStratified", inInfo.getBlock("MABlock").getCell(i, "fdIsStratified"));//是否分层
							_argMap.put("fdIsWings", inInfo.getBlock("MABlock").getCell(i, "fdIsWings"));//是否两翼开采
							dao.update("ZMCSMiningarea.update", _argMap);//更新
						}
					}
				}
			}
			//删除
			for(int j=0; j<_list.size();j++)
			{
				ZMCSMiningarea _temp = (ZMCSMiningarea)_list.get(j);
				int count =0;
				for (int i=0;i<inInfo.getBlock("MABlock").getRowCount();i++) {
					String fdKeyId = inInfo.getBlock("MABlock").getCell(i, "fdKeyId").toString();
					if (!_temp.getFdKeyId().equals(fdKeyId)) {
						count++;						
					}
				}
				if(count == inInfo.getBlock("MABlock").getRowCount())
				{
					Map<String, String> _argMap = new HashMap<String, String>();
					_argMap.put("fdKeyId", _temp.getFdKeyId().toString());
					dao.delete("ZMCSMiningarea.delete", _argMap);//删除
				}
			}
		}
		
		EiInfo outInfo = new EiInfo();
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.mineStabilty",false));//稳定性
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.mineType",true));//煤种
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.dipType",true));//倾斜类型
		outInfo.setStatus(1);
		return outInfo;
	}
	
	/**首次进入系统新增煤层信息
	 * <p>Function: insertMA</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	public EiInfo insertCoalseam(EiInfo inInfo) {
		List<Map>  _list = new ArrayList();
		Map para = new HashMap();
		_list = dao.query("ZMCSCoalseam.query", para);
		if(_list.size() ==0)//首次新增
		{
			for(int i=0;i<inInfo.getBlock("CBlock").getRowCount();i++)
			{
				inInfo.getBlock("CBlock").setCell(i, "fdKeyId", TablePk.getInstance().getNextValue("T_CI_COALSEAM"));//主键
			}
			super.insert(inInfo, "ZMCSCoalseam.insert", "CBlock");
		}else
		{
			for(int i=0;i<inInfo.getBlock("CBlock").getRowCount();i++)
			{
				String fdKeyId = inInfo.getBlock("CBlock").getCell(i, "fdKeyId").toString();
				if(fdKeyId.equals(""))
				{
					Map map = new HashMap();
					map.put("fdKeyId", TablePk.getInstance().getNextValue("T_CI_COALSEAM"));//主键
					map.put("fdElevation", inInfo.getBlock("CBlock").getCell(i, "fdElevation"));//标高
					map.put("fdName", inInfo.getBlock("CBlock").getCell(i, "fdName"));//煤层名称
					map.put("fdNo", inInfo.getBlock("CBlock").getCell(i, "fdNo"));//煤层编号
					map.put("fdThickness", inInfo.getBlock("CBlock").getCell(i, "fdThickness"));//厚度平均值
					map.put("fdDip", inInfo.getBlock("CBlock").getCell(i, "fdDip"));//平均倾角
					map.put("fdDensity", inInfo.getBlock("CBlock").getCell(i, "fdDensity"));//容重
					map.put("fdStabilty", inInfo.getBlock("CBlock").getCell(i, "fdStabilty"));//稳定性
					map.put("fdSpecies", inInfo.getBlock("CBlock").getCell(i, "fdSpecies"));//煤种
					map.put("fdGasMeasuringpoint", inInfo.getBlock("CBlock").getCell(i, "fdGasMeasuringpoint"));//瓦斯测点
					map.put("fdThicknessMax", inInfo.getBlock("CBlock").getCell(i, "fdThicknessMax"));//厚度最大值
					map.put("fdThicknessMin", inInfo.getBlock("CBlock").getCell(i, "fdThicknessMin"));//厚度最小值
					map.put("fdDipType", inInfo.getBlock("CBlock").getCell(i, "fdDipType"));//倾斜类型
					map.put("fdGasPressure", inInfo.getBlock("CBlock").getCell(i, "fdGasPressure"));//瓦斯压力
					map.put("fdGasDensity", inInfo.getBlock("CBlock").getCell(i, "fdGasDensity"));//瓦斯浓度
					map.put("fdWater", inInfo.getBlock("CBlock").getCell(i, "fdWater"));//水分
					map.put("fdAsh", inInfo.getBlock("CBlock").getCell(i, "fdAsh"));//灰分
					map.put("fdSulfur", inInfo.getBlock("CBlock").getCell(i, "fdSulfur"));//硫分
					map.put("fdVolatile", inInfo.getBlock("CBlock").getCell(i, "fdVolatile"));//挥发分
					map.put("fdHeat", inInfo.getBlock("CBlock").getCell(i, "fdHeat"));//发热量
					dao.insert("ZMCSCoalseam.insert", map);//新增
				}else
				{
					for(int j=0; j<_list.size();j++){
						ZMCSCoalseam _temp = (ZMCSCoalseam)_list.get(j);
						if (_temp.getFdKeyId().equals(fdKeyId)) {
							Map _argMap = new HashMap();
							_argMap.put("fdKeyId", fdKeyId);
							_argMap.put("fdElevation", inInfo.getBlock("CBlock").getCell(i, "fdElevation"));//标高
							_argMap.put("fdName", inInfo.getBlock("CBlock").getCell(i, "fdName"));//煤层名称
							_argMap.put("fdNo", inInfo.getBlock("CBlock").getCell(i, "fdNo"));//煤层编号
							_argMap.put("fdThickness", inInfo.getBlock("CBlock").getCell(i, "fdThickness"));//厚度平均值
							_argMap.put("fdDip", inInfo.getBlock("CBlock").getCell(i, "fdDip"));//平均倾角
							_argMap.put("fdDensity", inInfo.getBlock("CBlock").getCell(i, "fdDensity"));//容重
							_argMap.put("fdStabilty", inInfo.getBlock("CBlock").getCell(i, "fdStabilty"));//稳定性
							_argMap.put("fdSpecies", inInfo.getBlock("CBlock").getCell(i, "fdSpecies"));//煤种
							_argMap.put("fdGasMeasuringpoint", inInfo.getBlock("CBlock").getCell(i, "fdGasMeasuringpoint"));//瓦斯测点
							_argMap.put("fdThicknessMax", inInfo.getBlock("CBlock").getCell(i, "fdThicknessMax"));//厚度最大值
							_argMap.put("fdThicknessMin", inInfo.getBlock("CBlock").getCell(i, "fdThicknessMin"));//厚度最小值
							_argMap.put("fdDipType", inInfo.getBlock("CBlock").getCell(i, "fdDipType"));//倾斜类型
							_argMap.put("fdGasPressure", inInfo.getBlock("CBlock").getCell(i, "fdGasPressure"));//瓦斯压力
							_argMap.put("fdGasDensity", inInfo.getBlock("CBlock").getCell(i, "fdGasDensity"));//瓦斯浓度
							_argMap.put("fdWater", inInfo.getBlock("CBlock").getCell(i, "fdWater"));//水分
							_argMap.put("fdAsh", inInfo.getBlock("CBlock").getCell(i, "fdAsh"));//灰分
							_argMap.put("fdSulfur", inInfo.getBlock("CBlock").getCell(i, "fdSulfur"));//硫分
							_argMap.put("fdVolatile", inInfo.getBlock("CBlock").getCell(i, "fdVolatile"));//挥发分
							_argMap.put("fdHeat", inInfo.getBlock("CBlock").getCell(i, "fdHeat"));//发热量
							dao.update("ZMCSCoalseam.update", _argMap);//更新
						}
					}
				}
			}
			//删除
			for(int j=0; j<_list.size();j++)
			{
				ZMCSCoalseam _temp = (ZMCSCoalseam)_list.get(j);
				int count =0;
				for (int i=0;i<inInfo.getBlock("CBlock").getRowCount();i++) {
					String fdKeyId = inInfo.getBlock("CBlock").getCell(i, "fdKeyId").toString();
					if (!_temp.getFdKeyId().equals(fdKeyId)) {
						count++;						
					}
				}
				if(count == inInfo.getBlock("CBlock").getRowCount())
				{
					Map<String, String> _argMap = new HashMap<String, String>();
					_argMap.put("fdKeyId", _temp.getFdKeyId().toString());
					dao.delete("ZMCSCoalseam.delete", _argMap);//删除
				}
			}
		}
		
		EiInfo outInfo = new EiInfo();
		String fdMiningId = (String) UserSession.getInSessionProperty("miningCode");//矿ID的默认值
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.coalType",true));//采煤方法
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.recoveryProcess",false));//回采工艺
		outInfo.addBlock(RoadWay.getYesORNoBlock("cmes.cb.isFirst"));//是否首采区
		outInfo.addBlock(Coalseam.getWorkStatusBlock("cmes.cb.status"));//施工状态
		outInfo.addBlock(Miningarea.getParnetInforWfBlock());//采面所属下拉框
		outInfo.addBlock(Coalseam.getParnetInforCBlock("cmes.cb.parentInforC", fdMiningId, true));//所属煤层下拉框
		outInfo.setStatus(1);
		return outInfo;
	}
	
	/**首次进入系统新增采面信息
	 * <p>Function: insertWorkingface</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	public EiInfo insertWorkingface(EiInfo inInfo) {
		List<Map>  _list = new ArrayList();
		Map para = new HashMap();
		_list = dao.query("ZMCSWorkingFace.query", para);
		if(_list.size() ==0)//首次新增
		{
			for(int i=0;i<inInfo.getBlock("CMBlock").getRowCount();i++)
			{
				inInfo.getBlock("CMBlock").setCell(i, "fdKeyId", TablePk.getInstance().getNextValue("T_CI_WORKINGFACE"));//主键
				inInfo.getBlock("CMBlock").setCell(i, "fdAbbreviation", inInfo.getBlock("CMBlock").getCell(i, "fdName"));//工作面简称
				inInfo.getBlock("CMBlock").setCell(i, "fdDeleteStatus", "1");//删除状态
			}
			super.insert(inInfo, "ZMCSWorkingFace.insert", "CMBlock");
		}else
		{
			for(int i=0;i<inInfo.getBlock("CMBlock").getRowCount();i++)
			{
				String fdKeyId = inInfo.getBlock("CMBlock").getCell(i, "fdKeyId").toString();
				if(fdKeyId.equals(""))
				{
					Map map = new HashMap();
					map.put("fdKeyId", TablePk.getInstance().getNextValue("T_CI_WORKINGFACE"));//主键
					map.put("fdParentId", inInfo.getBlock("CMBlock").getCell(i, "fdParentId"));//所属区域
					map.put("fdName", inInfo.getBlock("CMBlock").getCell(i, "fdName"));//采面编号
					map.put("fdNo", inInfo.getBlock("CMBlock").getCell(i, "fdNo"));//采面名称
					map.put("fdCoalseamId", inInfo.getBlock("CMBlock").getCell(i, "fdCoalseamId"));//所属煤层
					map.put("fdLength", inInfo.getBlock("CMBlock").getCell(i, "fdLength"));//平均长度
					map.put("fdHeight", inInfo.getBlock("CMBlock").getCell(i, "fdHeight"));//采高
					map.put("fdWidth", inInfo.getBlock("CMBlock").getCell(i, "fdWidth"));//宽度
					map.put("fdCoalType", inInfo.getBlock("CMBlock").getCell(i, "fdCoalType"));//采煤方法
					map.put("fdReserves", inInfo.getBlock("CMBlock").getCell(i, "fdReserves"));//储量
					map.put("fdStatus", inInfo.getBlock("CMBlock").getCell(i, "fdStatus"));//施工状态
					map.put("fdAbbreviation", inInfo.getBlock("CMBlock").getCell(i, "fdName"));//厚度最小值
					map.put("fdDeleteStatus", inInfo.getBlock("CMBlock").getCell(i, "fdDeleteStatus"));//倾斜类型
					map.put("fdRecoveryProcess", inInfo.getBlock("CMBlock").getCell(i, "fdRecoveryProcess"));//瓦斯压力
					map.put("fdManufacturability", inInfo.getBlock("CMBlock").getCell(i, "fdManufacturability"));//瓦斯浓度
					map.put("fdChance", inInfo.getBlock("CMBlock").getCell(i, "fdChance"));//水分
					map.put("fdSurplusToLength", inInfo.getBlock("CMBlock").getCell(i, "fdSurplusToLength"));//灰分
					map.put("fdSurplusReserves", inInfo.getBlock("CMBlock").getCell(i, "fdSurplusReserves"));//硫分
					map.put("fdBeginDate", inInfo.getBlock("CMBlock").getCell(i, "fdBeginDate"));//开采日期
					map.put("fdEndDate", inInfo.getBlock("CMBlock").getCell(i, "fdEndDate"));//结束日期
					map.put("fdNeedWind", inInfo.getBlock("CMBlock").getCell(i, "fdNeedWind"));//所需风量
					map.put("fdIsFirst", inInfo.getBlock("CMBlock").getCell(i, "fdIsFirst"));//是否采区首采
					map.put("fdDensity", inInfo.getBlock("CMBlock").getCell(i, "fdDensity"));//容重
					dao.insert("ZMCSWorkingFace.insert", map);//新增
				}else
				{
					for(int j=0; j<_list.size();j++){
						ZMCSWorkingFace _temp = (ZMCSWorkingFace)_list.get(j);
						if (_temp.getFdKeyId().equals(fdKeyId)) {
							Map _argMap = new HashMap();
							_argMap.put("fdKeyId", fdKeyId);
							_argMap.put("fdParentId", inInfo.getBlock("CMBlock").getCell(i, "fdParentId"));//所属区域
							_argMap.put("fdName", inInfo.getBlock("CMBlock").getCell(i, "fdName"));//采面编号
							_argMap.put("fdNo", inInfo.getBlock("CMBlock").getCell(i, "fdNo"));//采面名称
							_argMap.put("fdCoalseamId", inInfo.getBlock("CMBlock").getCell(i, "fdCoalseamId"));//所属煤层
							_argMap.put("fdLength", inInfo.getBlock("CMBlock").getCell(i, "fdLength"));//平均长度
							_argMap.put("fdHeight", inInfo.getBlock("CMBlock").getCell(i, "fdHeight"));//采高
							_argMap.put("fdWidth", inInfo.getBlock("CMBlock").getCell(i, "fdWidth"));//宽度
							_argMap.put("fdCoalType", inInfo.getBlock("CMBlock").getCell(i, "fdCoalType"));//采煤方法
							_argMap.put("fdReserves", inInfo.getBlock("CMBlock").getCell(i, "fdReserves"));//储量
							_argMap.put("fdStatus", inInfo.getBlock("CMBlock").getCell(i, "fdStatus"));//施工状态
							_argMap.put("fdAbbreviation", inInfo.getBlock("CMBlock").getCell(i, "fdName"));//厚度最小值
							_argMap.put("fdDeleteStatus", inInfo.getBlock("CMBlock").getCell(i, "fdDeleteStatus"));//倾斜类型
							_argMap.put("fdRecoveryProcess", inInfo.getBlock("CMBlock").getCell(i, "fdRecoveryProcess"));//瓦斯压力
							_argMap.put("fdManufacturability", inInfo.getBlock("CMBlock").getCell(i, "fdManufacturability"));//瓦斯浓度
							_argMap.put("fdChance", inInfo.getBlock("CMBlock").getCell(i, "fdChance"));//水分
							_argMap.put("fdSurplusToLength", inInfo.getBlock("CMBlock").getCell(i, "fdSurplusToLength"));//灰分
							_argMap.put("fdSurplusReserves", inInfo.getBlock("CMBlock").getCell(i, "fdSurplusReserves"));//硫分
							_argMap.put("fdBeginDate", inInfo.getBlock("CMBlock").getCell(i, "fdBeginDate"));//开采日期
							_argMap.put("fdEndDate", inInfo.getBlock("CMBlock").getCell(i, "fdEndDate"));//结束日期
							_argMap.put("fdNeedWind", inInfo.getBlock("CMBlock").getCell(i, "fdNeedWind"));//所需风量
							_argMap.put("fdIsFirst", inInfo.getBlock("CMBlock").getCell(i, "fdIsFirst"));//是否采区首采
							_argMap.put("fdDensity", inInfo.getBlock("CMBlock").getCell(i, "fdDensity"));//容重
							dao.update("ZMCSWorkingFace.update", _argMap);//更新
						}
					}
				}
			}
			//删除
			for(int j=0; j<_list.size();j++)
			{
				ZMCSWorkingFace _temp = (ZMCSWorkingFace)_list.get(j);
				int count =0;
				for (int i=0;i<inInfo.getBlock("CMBlock").getRowCount();i++) {
					String fdKeyId = inInfo.getBlock("CMBlock").getCell(i, "fdKeyId").toString();
					if (!_temp.getFdKeyId().equals(fdKeyId)) {
						count++;						
					}
				}
				if(count == inInfo.getBlock("CMBlock").getRowCount())
				{
					Map<String, String> _argMap = new HashMap<String, String>();
					_argMap.put("fdKeyId", _temp.getFdKeyId().toString());
					dao.delete("ZMCSWorkingFace.delete", _argMap);//删除
				}
			}
		}

		EiInfo outInfo = new EiInfo(); 
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.mineRock",false));//煤岩类别
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.roadwayType",false));//巷道类别
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.grubProcess",false));//掘进工艺
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.supportingType",true));//支护方式
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.roadwayUsing",false));//巷道用途
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.sectionShape",true));//断面形状
		outInfo.addBlock(Coalseam.getWorkStatusBlock("cmes.cb.status"));//施工状态
		outInfo.addBlock(RoadWay.getParnetInfoRoadWayBlock());//巷道所属下拉框
		outInfo.setStatus(1);
		return outInfo;
	}
	
	/**首次进入系统新增巷道信息
	 * <p>Function: insertRoadWay</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	public EiInfo insertRoadWay(EiInfo inInfo) {
		for(int i=0;i<inInfo.getBlock("RWBlock").getRowCount();i++)
		{
			inInfo.getBlock("RWBlock").setCell(i, "fdKeyId", TablePk.getInstance().getNextValue("T_CI_WORKINGFACE"));//主键
			inInfo.getBlock("RWBlock").setCell(i, "fdAbbreviation", inInfo.getBlock("RWBlock").getCell(i, "fdName"));//主键
			inInfo.getBlock("RWBlock").setCell(i, "fdDeleteStatus", "1");//删除状态
		}
		super.insert(inInfo, "ZMCSRoadWay.insert", "RWBlock");
		return inInfo;
	}
	
	
	/**采区信息上一步删除水平或者矿井信息
	 * <p>Function: deleteMA</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	@SuppressWarnings({ "rawtypes", "unchecked"})
	public EiInfo queryHOrMine(EiInfo inInfo) {
		String value = "0";
		EiInfo outInfo = new EiInfo();
		if(value.equals("0"))//采区信息
		{
			inInfo.addBlock("HBlock").set("showCount", "true");
			inInfo.addBlock("HBlock").set("limit", -1);
		    outInfo = super.query(inInfo, "ZMCSLevel.query",  new ZMCSLevel(), false, null, EiConstant.queryBlock, "HBlock", "HBlock");
		}else
		{
			outInfo = super.query(inInfo, "ZMCSMine.query",  new ZMCSMine(), false, null, EiConstant.queryBlock, "mineBlock", "mineBlock");
		}
			
		
		return outInfo;
	}
	
	/**煤层信息上一步删除采区或者矿井信息
	 * <p>Function: deleteC</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	@SuppressWarnings({ "rawtypes", "unchecked"})
	public EiInfo queryMaOrMine(EiInfo inInfo) {
		String value = "0";
		EiInfo outInfo = new EiInfo();
		if(value.equals("0")||value.equals("1"))//采区信息
		{
			inInfo.addBlock("HBlock").set("showCount", "true");
			inInfo.addBlock("HBlock").set("limit", -1);
		    outInfo = super.query(inInfo, "ZMCSMiningarea.query",  new ZMCSMiningarea(), false, null, EiConstant.queryBlock, "MABlock", "MABlock");
		}else
		{
			outInfo = super.query(inInfo, "ZMCSMine.query",  new ZMCSMine(), false, null, EiConstant.queryBlock, "mineBlock", "mineBlock");
		}
			
		return outInfo;
	}
	
	/**采面信息上一步删除煤层信息
	 * <p>Function: deleteCM</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	@SuppressWarnings({ "rawtypes", "unchecked"})
	public EiInfo queryC(EiInfo inInfo) {
		
		EiInfo outInfo = new EiInfo();
		inInfo.addBlock("CBlock").set("showCount", "true");
		inInfo.addBlock("CBlock").set("limit", -1);
	    outInfo = super.query(inInfo, "ZMCSCoalseam.query",  new ZMCSCoalseam(), false, null, EiConstant.queryBlock, "CBlock", "CBlock");
		return outInfo;
	}
	
	/**巷道信息上一步采面信息
	 * <p>Function: deleteR</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-06-21下午15:31:29  张坤
	 * </p>
	 *
	*/
	@SuppressWarnings({ "rawtypes", "unchecked"})
	public EiInfo queryCM(EiInfo inInfo) {
		
		EiInfo outInfo = new EiInfo();
		inInfo.addBlock("CMBlock").set("showCount", "true");
		inInfo.addBlock("CMBlock").set("limit", -1);
	    outInfo = super.query(inInfo, "ZMCSWorkingFace.query",  new ZMCSWorkingFace(), false, null, EiConstant.queryBlock, "CMBlock", "CMBlock");
		return outInfo;
	}
 
	/** 矿井模型树操作
	 * 查询根节点下的数据
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: query</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2016-7-2上午11:03:09  张坤
	 * </p>
	 *
	 */
	@SuppressWarnings("rawtypes")
	public EiInfo query(EiInfo inInfo) {
		QueryMap queryInfo = QueryMap.getQueryMap(inInfo);
		String _node = (String) queryInfo.get(TreeConstants.TREE_NODE);
		String level = (String) queryInfo.get("level");
		List _list = new ArrayList();
		
		if (_node == null) {
			_node = "$";
		}
		if ("$".equals(_node)) {
			_list = this.getTopNodes();//得到根节点
		} else {
			_list = this.getChildNodes(_node, level);
		}

		EiInfo outInfo = new EiInfo();
		EiBlock block = outInfo.addBlock(_node);
		block.setBlockMeta(initMetaData());
		block.setRows(_list);
		return outInfo;
	}
	
	/**构造矿井信息树节点的孩子节点
	 * <p>Function: getChildNodes</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS04</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *     2016-7-2上午11:03:09  张坤
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public List getChildNodes(String _arg, String level) {
		String[] _nodeId=_arg.split("_");
		_arg=_nodeId[0];
		level=_nodeId[1];
		
		
		String parentLabel = _arg;
		Map<String, String> _argMap = new HashMap<String, String>();
		_argMap.put(TreeConstants.TREE_NODE, parentLabel);
		int _int = level == null ? 0 : Integer.parseInt(level);
		String value = "0";
		if(value.equals("0"))
		{
			switch(_int) {
			case 0:
				//水平
				List<Map> listL = Level.getLevel(_argMap);
				//巷道
				return RoadWay.getRoadWay(listL,_argMap);
			case 1:
				//采区
				List<Map> listMA = Miningarea.getMiningarea(_argMap);
				//巷道
				return RoadWay.getRoadWay(listMA,_argMap);
			case 2:
				//采面
				List<Map> listWf =  WorkingFace.getWorkingface(_argMap);
				//巷道
				return RoadWay.getRoadWay(listWf,_argMap);
			default:
				//巷道
				return RoadWay.getRoadWay(new ArrayList(),_argMap);
			}
		}else if(value.equals("1")){
			switch(_int) {
			case 0:
				//采区
				List<Map> listMA = Miningarea.getMiningarea(_argMap);
				//巷道
				return RoadWay.getRoadWay(listMA,_argMap);
			case 2:
				//采面
				List<Map> listWf =  WorkingFace.getWorkingface(_argMap);
				//巷道
				return RoadWay.getRoadWay(listWf,_argMap);
			default:
				//巷道
				return RoadWay.getRoadWay(new ArrayList(),_argMap);
			}
		}else
		{
			if(_int != 3)
			{
				//采面
				List<Map> listWf = WorkingFace.getWorkingface(_argMap);
				//巷道
				return RoadWay.getRoadWay(listWf,_argMap);
			}else
			{
				//巷道
				return RoadWay.getRoadWay(new ArrayList(),_argMap);
			}
			
		}
	}
	
	/**
	 * 父类的方法
	 * <p>Function: getChildNodes</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS40</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-1上午01:56:07 严洪浩
	 * </p>
	 *
	 */
	@SuppressWarnings("rawtypes")
	@Override
	public List getChildNodes(String arg0) {
		return null;
	}
	
	/**
	 * 矿井树结构：得到根节点数据
	 * <p>Function: getTopNodes</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCM01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2016-7-2上午11:03:09  张坤
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public List getTopNodes() {
		List _topNodes = new ArrayList();
		Map<String, String> _argMap = new HashMap<String, String>();
		_argMap.put("fdMiningId", UserSession.getInSessionProperty("miningCode").toString());
		_topNodes = dao.query("ZMCSMine.queryTree", _argMap);	
		return _topNodes;
	}
	
	/**
	 * 叶子列定义
	 * <p>Function: initMetaData</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCM01</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-03-07下午15:31:29  张坤
	 * </p>
	 *
	 */
	@Override
	public EiBlockMeta initMetaData() {
		EiBlockMeta eiMetadata = new EiBlockMeta();

		EiColumn eiColumn = new EiColumn("text");
		eiColumn.setDescName("显示名称");
		eiColumn.setNullable(false);
		eiColumn.setPrimaryKey(false);
		eiMetadata.addMeta(eiColumn);

		eiColumn = new EiColumn("label");
		eiColumn.setDescName("实际值");
		eiColumn.setNullable(false);
		eiColumn.setPrimaryKey(false);
		eiMetadata.addMeta(eiColumn);
//		imagePath
		eiColumn = new EiColumn("level");
		eiColumn.setDescName("树级别");
		eiColumn.setNullable(false);
		eiColumn.setPrimaryKey(false);
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("type");
		eiColumn.setDescName("所属类别");
		eiColumn.setNullable(false);
		eiColumn.setPrimaryKey(false);
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("leaf");
		eiColumn.setDescName("是否叶子节点");
		eiColumn.setType(EiConstant.COLUMN_TYPE_NUMBER);
		eiColumn.setNullable(false);
		eiColumn.setPrimaryKey(false);
		eiMetadata.addMeta(eiColumn);
		
		return eiMetadata;
	}
	
	/**
	 * 新增矿井信息
	 * <p>Function: insert</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS02</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2016-7-2上午11:03:09  张坤
	 * </p>
	 *
	 */
	public EiInfo insert(EiInfo inInfo)
	{
        boolean validate = validate(inInfo, "ZMCSMine.validate", new HashMap<String, String>());
		
		if(validate) 
		{
			return inInfo;
		}
		else 
		{
			inInfo.getBlock(EiConstant.resultBlock).setCell(0, "fdKeyId", TablePk.getInstance().getNextValue("T_CI_MINE"));//主键
			inInfo.getBlock(EiConstant.resultBlock).setCell(0, "fdStatus", "生产");//状态
			inInfo.getBlock(EiConstant.resultBlock).setCell(0, "fdDepartmentId", UserSession.getInSessionProperty("orgCode"));//部门id
			EiInfo outInfo = super.insert(inInfo, "ZMCSMine.insert", EiConstant.resultBlock);
			return outInfo;
		}
	}
	
	/**
	 * 修改矿井信息
	 * <p>Function: update</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS02</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2016-7-2上午11:03:09  张坤
	 * </p>
	 *
	 */
	public EiInfo update(EiInfo inInfo)
	{
		Map<String, String> params = new HashMap<String, String>();
		params.put("fdKeyId", inInfo.getBlock("result").getCellStr(0, "fdKeyId"));
		
		boolean validate = validate(inInfo, "ZMCSMine.validate", params);
		if(validate)
		{
			return inInfo;
		}
		else 
		{
			EiInfo outInfo = super.update(inInfo, "ZMCSMine.update");
			return outInfo;
		}
	}
	
	/**
	 * 删除水平信息
	 * <p>Function: delete</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS02</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2016-7-2上午11:03:09  张坤
	 * </p>
	 *
	 */
	public EiInfo delete(EiInfo inInfo) 
	{
        String fdKeyId = inInfo.getString("fdKeyId");
        Map<String, String> _map = new HashMap<String, String>();
		_map.put("fdKeyId", fdKeyId);
		boolean validate = this.canDelete(inInfo, fdKeyId);//矿井是否被引用
		if(validate) {
			return inInfo;
		}
		else {
			dao.delete("ZMCSMine.delete", _map);
			return inInfo;
		}
	}
	
	/**
	 * 校验名称和编号
	 * <p>Function: validate</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCS02</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2016-7-2上午11:03:09  张坤
	 * </p>
	 *
	 */
	@SuppressWarnings("rawtypes")
	private boolean validate(EiInfo inInfo, String sqlName, Map<String, String> params) {
		if(params == null) {
			params = new HashMap<String, String>();
		}
		
		String fdNo = inInfo.getBlock("result").getCellStr(0, "fdNo");
		String fdName = inInfo.getBlock("result").getCellStr(0, "fdName");
		
		params.put("fdNo", fdNo);
		params.put("fdName", fdName);
		
		List result = dao.query("ZMCSMine.validate", params);
		if(result != null && result.size() > 0) {
			inInfo.setStatus(-1);
			ZMCSMine _temp = (ZMCSMine)result.get(0);
			
			StringBuffer msg = new StringBuffer("提交失败，");
			if(_temp.getFdNo() != null && _temp.getFdNo().equals(fdNo)){
				msg.append(" 编号 ");
			}
			if(_temp.getFdName() != null && _temp.getFdName().equals(fdName)) {
				msg.append(" 名称 ");
			}
			msg.append("重复！");
			
			inInfo.setMsg(msg.toString());
			return true;
		}
		return false;
	}
	
	/**
	 * 检查矿井是否可以删除隐患
	 * <p>Function: canDelete</p>
	 * <p>Description: </p>
	 * <p>return value:void</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-3-7下午01:32:59 张坤
	 * </p>
	 *
	 */
	private boolean canDelete(EiInfo inInfo, String fdKeyId) {
		if(fdKeyId == null) {
			fdKeyId = new String("");
		}
		
		Map<String, String> _argMap = new HashMap<String, String>();
		_argMap.put("fdKeyId", fdKeyId);
		
		List<?> _result = dao.query("ZMCSLevel.canDelete", _argMap);
		
		if(_result.size() > 0) {
			inInfo.setStatus(-1);
			inInfo.setMsg("有水平已经关联了此矿井，不能删除！");
			return true;
		}
        List<?> _result1 = dao.query("ZMCSMiningarea.canDelete", _argMap);
		
		if(_result1.size() > 0) {
			inInfo.setStatus(-1);
			inInfo.setMsg("有采区已经关联了此矿井，不能删除！");
			return true;
		}
        List<?> _result2 = dao.query("ZMCSWorkingFace.canDelete", _argMap);
		
		if(_result2.size() > 0) {
			inInfo.setStatus(-1);
			inInfo.setMsg("有采面已经关联了此矿井，不能删除！");
			return true;
		}
        List<?> _result3 = dao.query("ZMCSRoadWay.canDelete", _argMap);
		
		if(_result3.size() > 0) {
			inInfo.setStatus(-1);
			inInfo.setMsg("有巷道已经关联了此矿井，不能删除！");
			return true;
		}
		return false;
	}

	/**
	 * 根据ID获得该对象
	 * <p>Function: getMineByID</p>
	 * <p>Description: </p>
	 * <p>return value:EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2016-07-05 下午15:31:29  张坤
	 * </p>
	 *
	 */
	@SuppressWarnings({ "null", "rawtypes", "unchecked" })
	public EiInfo getMineByID(EiInfo inInfo) {
		StaticTools.setQueryParameters(inInfo, "fdKeyId", inInfo.getString("fdKeyId"), true);
		EiInfo outInfo = super.query(inInfo, "ZMCSMine.query", new ZMCSMine());
		return outInfo;
		
		
	}
}
